package subumbo.audio.generator
{
	import __AS3__.vec.Vector;
	
	import flash.events.Event;
	
	import subumbo.audio.core.AudioEngine;
	import subumbo.audio.core.IAudioProcessor;

	public class Audio extends SoundLoader implements IAudioProcessor
	{
		private var _playing:Boolean;
		private var _deactivatedFunction:Function;
		private var _activateFucntion:Function;
		private var _addEffectFucntion:Function;
		private var _removeEffectFunction:Function;
		private var _position:int;
		private var _loop:Boolean;
		private var _id:String;
		public function Audio(id:String, url:String)
		{
			
			AudioEngine.instance.addGenerator(this);
			if(url) load(url);
		}
		
		override protected function loadComplete(event:Event):void
		{
			super.loadComplete(event);
		}
		
		public function process(buffer: Vector.<Vector.<Number>>):void
		{
			if(_playing)
			{
				
			}else
			{
				
			}
		}
		
		public function set volume(val:Number):void
		{
		}
		
		public function deactivate():void
		{
			_deactivatedFunction.call(null,this);
		}
		
		public function activate():void
		{
			_activateFucntion.call(null,this);
		}
		
		public function play(startPosition:int = 0, loop:Boolean = false):void
		{
			if(_playing) return;
			_position = startPosition;
			_loop = loop;
			_playing = true;
		}
		
		public function stop():void
		{
			_playing = false;
		}
		
		
		
		
		public function set deactivatedFunction(val:Function):void
		{
			_deactivatedFunction = val;
		}
		
		public function set activateFunction(val:Function):void
		{
			_activateFucntion = val;
		}
		
		public function set addEffectFunction(val:Function):void
		{
			
		}
		public function set removeEffectFunction(val:Function):void
		{
			
		}
		
		public function addEffect(effect:IAudioProcessor):IAudioProcessor
		{
			return effect;
		}
		
		public function removeEffect(obj:Object):void
		{
			
		}
		
		public function get id():String
		{
			return "";
		}
		
		public function set id(val:String):void
		{
			_id = val;
		}
		
		public function setActivated(boo:Boolean):void
		{
			
		}
		
		public function flush():void
		{
			
		}
		
		public function set processIndex(val:int):void
		{
			
		}
		
		public function get processIndex():int
		{
			return 0;
		}
		
	}
}